package com.jinzheng.test;

import java.util.Arrays;

/**
 * @author Administrator
 * @date 2021/1/2 22:08
 * @description
 **/
public class Demo01 {
    public static void main(String[] args) {
        System.out.println("PetCode");
        int[] nums = {2,7,11,5};
        int target = 9;
        System.out.println(Arrays.toString(print(nums, target)));
    }

    public static int[] print(int[] nums, int target){
        int[] ans = new int[2];
        for (int i = 0;i<nums.length-1;i++){
            for (int j = i+1;j<nums.length;j++){
                if (nums[i]+nums[j]==target){
                    ans[0] = i;
                    ans[1] = j;
                    return ans;
                }
            }
        }
        return ans;
    }

}
